<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title>运营平台</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="renderer" content="webkit">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/common.css?v=20170207" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/table.css?v=20170117" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/jquery-ui.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-1.11.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ui.min.js" type="text/javascript"></script>
 <script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/yunIndex.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ym-datePlugin-0.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/global.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/cheshan/js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery.placeholder.min.js"></script>
<script type="text/javascript">
 $(function(){
     $("input").placeholder();
     if (navigator.userAgent.indexOf("Safari") > -1) {
       $("input").css("lineHeight","normal !important");
     };
});
</script>

<body>
<div class="header">
<div class="headerCo">
<span>你好,<?php echo ($user_info["real_name"]); ?><a href="<?php echo (WEB_URL); ?>Emp/logout">退出</a></span>
<h1><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_logo.jpg"></h1>
</div>
</div>
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/cashier.css"/>
<meta charset="UTF-8"/>
<script type="text/javascript">
    $(function(){
        $("input").placeholder();
        if (navigator.userAgent.indexOf("Safari") > -1) {
            $("input").css("lineHeight","normal !important");
        };
    });
</script>
<div class="mian">
    <div class="mianL">
    <dl>
        <dd>
            <a id="menu_sy" href="/Index/index" class="shouye">首页</a>
        </dd>
        <?php foreach ($tree_menu as $key => $value): ?>
          <dd>
            <span id="menu_<?php echo ($value['first_char']); ?>" ><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_jia.jpg"><?php echo ($value['name']); ?></span>
            <ul style="display: none;">
                <?php if (!empty($value['children'])): ?>
                    <?php foreach ($value['children'] as $k => $v): ?>
                        <li><a id='menu_<?php echo ($v["first_char"]); ?>' href="<?php echo ($v['url']); ?>"><?php echo ($v['name']); ?></a></li>
                    <?php endforeach ?>
                <?php endif ?>
            </ul>
        <?php endforeach ?>
    </dl>
</div>

<?php $menu = 'cggl.cgd'; ?>
<?php $menu=json_encode(explode('.', $menu)); ?>
<script>
    $(function () {
        var cur_menu = '<?php echo ($menu); ?>', cur_menu = eval('[' + cur_menu + ']'), cur_menu = cur_menu[0];
        if (cur_menu == "sy") {
            $("#menu_sy").removeClass('shouye').addClass('current');
        }
        $('#menu_' + cur_menu[0]).click();
        $('#menu_' + cur_menu[0]).find("img").attr("src", "http://img1.isou365.cn/paimai/yunying/images/yun_jie.jpg");
        $(".mianL").css("height", $(document).height() - 95);
        $('#menu_' + cur_menu[1]).addClass('current');
    });
</script>
    <div class="mianR">
        <div class="live-cont">
            <form id="search_form" action="/PurchaseOrder/purchase_order_list" method="get">
                <div class="live-seach">
                    <input type="hidden" id="p" name='p' value="" />
                    <ul class="clearfix">
                        <li>
                            <input type="text" name="purchase_order_nu" value="<?php echo I('get.purchase_order_nu');?>" placeholder="采购单号">
                        </li>
                        <li>
                            <input type="text" name="order_no"  value="<?php echo I('get.order_no');?>" placeholder="拍单号">
                        </li>
                        <li><span>时间：</span>
                            <input type="text" id="demoText2" name="starttime" class="live-time" value="<?php echo I('get.starttime');?>" placeholder="开始时间" readonly="">
                            <i class="time-xian"></i>
                            <input type="text" id="demoText3" name="endtime" class="live-time" value="<?php echo I('get.endtime');?>" placeholder="结束时间" readonly="">
                        </li>
                        <li><input type="button" value="搜索" onclick="search('#search_form')"/></li>
                    </ul>
                    <!--</form>-->
                </div>
            <table class="table">
                <thead>
                <tr>
                    <th width="12%">采购单号</th>
                    <th width="12%">拍单号</th>
                    <th width="10%">采购单状态</th>
                    <th width="13%">采购单类型</th>
                    <th width="12%">采购金额</th>
                    <th width="18%">创建时间</th>
                    <th width="10%">创建人</th>
                    <th width="15%">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php if(is_array($arr["list"])): foreach($arr["list"] as $key=>$data): ?><tr>
                        <td><?php echo ($data["purchase_order_nu"]); ?></td>
                        <td><?php echo ($data["order_no"]); ?></td>
                        <td><?php echo ($data["status_name"]); ?></td>
                        <td><?php echo ($data["type_name"]); ?></td>
                        <td>
                            <?php echo ($data["amount"]); ?>
                        </td>
                        <td><?php echo ($data["createtime"]); ?></td>
                        <td><?php echo ($data["create_by"]); ?></td>
                        <td>
                            <a href="/PurchaseOrder/detail/id/<?php echo ($data["id"]); ?>/action/view">查看</a>
                            <?php if($data['is_lock'] != 1 && $data['is_other_channel_deal'] != 1):?> <!-- 如果不是锁定且不是订单时 -->
                                <?php if($data['status'] == 1):?>
                                    <?php if($data['order_status'] < 11 && $data['transfer_result'] != 4):?> <!-- 如果是过户完成之前，且过户结果不为待提档时 可以发起违约-->
                                        <a href="/PurchaseOrder/detail/id/<?php echo ($data["id"]); ?>/action/do">违约</a>
                                    <?php else:?>
                                        <a href="javascript:" class="ash-grey">违约</a>
                                    <?php endif;?>

                                    <?php if(($data['order_status'] == 9 or $data['order_status'] == 10) && $data['is_dispute'] && $data['transfer_result'] != 4):?> <!-- 当过户结果为待提档时，也不能 发起争议-->
                                        <a href="/PurchaseOrder/detail/id/<?php echo ($data["id"]); ?>/action/do">争议</a>
                                    <?php else:?>
                                        <a href="javascript:" class="ash-grey">争议</a>
                                    <?php endif;?>
                                <?php endif;?>
                            <?php else:?>
                                <a href="javascript:" class="ash-grey">违约</a>
                                <a href="javascript:" class="ash-grey">争议</a>
                            <?php endif;?>
                        </td>
                    </tr><?php endforeach; endif; ?>
                </tbody>
            </table>
        </div>
        <div class="pageFaye">
            <div class="pager">
                <?php echo ($page_data["totalRows"]); ?> 条记录 <?php echo ($page_data["nowPage"]); ?> /<?php echo ($page_data["totalPages"]); ?> 页
                <span name="first" class="disabled" style="cursor: default;">
                                <a num="<?php echo ($page_data["first"]["num"]); ?>" href="<?php echo ($page_data["first"]["url"]); ?>">首页</a>
                            </span>
                <span name="prev" class="disabled" style="cursor: default;">
                                <a num="<?php echo ($page_data["prev"]["num"]); ?>" href="<?php echo ($page_data["prev"]["url"]); ?>">上一页</a>
                            </span>
                <span name="nav_fix" style="cursor: pointer;">
                                <?php foreach ($page_data['link_page'] as $page => $link): ?>
                    <?php if($page == $p){ ?>
                    <a class="navi"  num="<?php echo $page;?>" href="<?php echo $link;?>">
                                    <font style="color:#fff"><?php echo $page;?></font>
                                </a>
                    <?php }else{?>
                    <a class="navi"  num="<?php echo $page;?>" href="<?php echo $link;?>">
                                    <?php echo $page;?>
                                </a>
                    <?php }?>
                    <?php endforeach ?>
                            </span>
                <span name="next" class="pageNext" style="cursor: pointer;"><a num="<?php echo ($page_data["next"]["num"]); ?>"  href="<?php echo ($page_data["next"]["url"]); ?>">下一页</a></span>
                <span name="last" class="pageLast" style="cursor: pointer;"><a num="<?php echo ($page_data["end"]["num"]); ?>"  href="<?php echo ($page_data["end"]["url"]); ?>">末页</a></span>
            </div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </div>
    </form>
</div>

<!---->
<div class="chenggong1">
    <span class="paidan">您确定要<i>启用</i>活动吗?</span>
    <div class="shenhei-btn">
        <input type="hidden" name="act"  value="" />
        <input type="hidden" name="activity_id"  value="" />
        <input type="button" value="确定" class="determine" />
        <input type="button" value="取消" class="cancel" />
    </div>
</div>

<script type="text/javascript">
    $('#search_form .pageFaye a').click(function () {
        $('#p').val($(this).attr('num'));
        $('#fm').submit();
        return false;
    });

    //搜索
    function search(from_id) {
        $(from_id).submit();
    }


    //审核确认窗口
    function audit(activity_id, act) {
        $('.chenggong1').css('display', 'block');
        $('.yunBei').css({'display':'block',"zIndex":999});

        $('input[name=activity_id]').val(activity_id);
        if (act == 'enable') {
            $('.paidan i').text('启用');
            $('input[name=act]').val('enable');
        } else if (act == 'disable') {
            $('.paidan i').text('禁用');
            $('input[name=act]').val('disable');
        }
    }
    //
    $(".determine").on('click', function () {
        var act = $('input[name=act]').val();
        var order_id = $('input[name=activity_id]').val();
        var param = {};
        param = {
            'act': act,
            'id': order_id,
        };

        var btn_obj = $(this);
        btn_obj.val("提交中...").attr("disabled",'disabled');
        $.post('/AuOrder/audit', param, function (data) {
            if (data.code == '200') {
                delay_alert('操作成功!');
                setTimeout(function () {
                    window.location.reload();
                }, 300);
            } else {
                shibai_alert(data.msg)
                btn_obj.val("确定").removeAttr("disabled style");
                $('.chenggong1').fadeOut();
                $('.chenggong1 textarea').remove();
            }
            $('.yunBei').css({'display':'none',"zIndex":999});
        }, 'json');
    });
    $(".cancel").on('click', function () {
        $('.chenggong1').fadeOut();
        $('.yunBei').css({'display':'none',"zIndex":999});
        $('.chenggong1 textarea').remove();
    });
</script>
<div class="yunBei"></div>
<div class="loading"></div>
</body>
</html>